package prefixAnd;

public class LargestAltitude {
    public int largestAltitude(int[] gain) {
        int largest = 0;
        int prefixAnd = 0;
        for(int next:gain){
            prefixAnd = prefixAnd + next;
            largest = Math.max(largest, prefixAnd);
        }
        return largest;
    }
}
